package com.bwie.controller;

import com.bwie.common.domain.Activity;
import com.bwie.common.domain.Record;
import com.bwie.common.domain.response.AddResponse;
import com.bwie.common.result.Result;
import com.bwie.service.ActivityService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

/**
 * @className: Activity
 * @Description: TODO
 * @version: v1.８.0
 * @author: 房新路
 * @date: 2025/8/7 20:13
 */
@RestController
public class ActivityController {
    @Autowired
    private ActivityService activityService;
    //活动列表
    @PostMapping("activityList")
    public Result<PageInfo<Activity>> activityList(@RequestBody Activity activity){
        PageInfo<Activity> list=activityService.activityList(activity);
        return Result.success(list);
    }
    //抽奖记录列表
    @PostMapping("recordList")
    public Result<PageInfo<Record>> recordList(@RequestBody Record record){
        PageInfo<Record> list=activityService.recordList(record);
        return Result.success(list);
    }

    /**
     * 添加记录表
     * @param addResponse
     * @return
     */
    @PostMapping("activityAdd")
    public Result activityAdd(@RequestBody AddResponse addResponse){
        activityService.activityAdd(addResponse);
        return Result.success();
    }
    /**
     * 图片
     */
    @PostMapping("upload")
    public Result upload( @RequestParam("files") MultipartFile[] files){
        return Result.success(activityService.upload(files));
    }
}